21FLDADE Report

Author

Tylar Murray

Code
librarian::shelf(
  dplyr,
  glue,
  here,
  tidyr
)
read in the WIN txt pipe-delimited file
source(here("R/getData.R"))
df <- getData() %>%
  filter(`Organization.ID` == params$org_id)
Skipped lines:
Requested report - WIN WAVES
PROJECT ID - PROJECT NAME = PROJ-001 - Surfacewater Quality Monitoring Network | WQMP - Water Quality Monitoring Program | JTDIEOFF - Julia Tuttle Die-Off Monitoring | FKNMSFIELD - FKNMS-DEP Field Sampling | WQMP - Water Quality Monitoring Program | EPA - Water Quality Monitoring Program | SJCUD RIVER SAMPLING - Water Quality Monitoring Program | BBWQ - Biscayne Bay Water Quality | WQMP - Water Quality Monitoring Program | BBWQ - Biscayne Bay Water Quality Monitoring Program | WQMP - Water Quality Monitoring Program | ERMWQ - PBC ERM Ambient Water Quality Monitoring | WQMP - Tampa Bay Water Alafia River Watershed Water Quality Monitoring
PROJECT INTENDED USE = Routine Monitoring | IWR Assessment/TMDL Listing | Modeling | 319 Program | BMAP | Trend Analysis | Event Response
COUNTY = BROWARD, FLORIDA | MARTIN, FLORIDA | MIAMI-DADE, FLORIDA | MONROE, FLORIDA | PALM BEACH, FLORIDA
DEP ANALYTE GROUP = General Physical-Chemical | Field Observation | Nutrients
DEP ANALYTE NAME - UNIT = Ammonia (N) - mg/kg | Ammonia (N) - mg/L | Nitrogen- Total Kjeldahl - mg/kg | Nitrogen- Total Kjeldahl - mg/L | Nitrate (N) - mg/L | Nitrate-Nitrite (N) - mg/kg | Nitrate-Nitrite (N) - mg/L | Nitrite (N) - mg/kg | Nitrite (N) - mg/L | Orthophosphate (P) - mg/L | pH - SU | Phosphorus- Total - mg/kg | Phosphorus- Total - mg/L | Salinity - PSU | Carbon- Organic - mg/kg | Carbon- Organic - mg/L | Nitrogen- Total - mg/L | Silica (SiO2) - mg/L | Dissolved Oxygen - mg/L | Temperature, Water - deg C | Carbon- Total - mg/kg | Silicate - mg/L
Report Run on MARCH 4, 2025
The data you are accessing are from the WIN Warehouse.  The WIN Warehouse is refreshed on a weekly basis with new data that are submitted to WIN.  The refresh process occurs on the weekend; data uploaded to WIN through each Friday are available in the WIN Warehouse by the following Monday.  WIN replaces Florida STORET as an active data repository.  Florida STORET data are accessible through STORET Public Access (SPA).
The following data met your selection criteria
read in the WIN txt pipe-delimited file
# Ensure the result value column is numeric (coerce if needed)
df$DEP.Result.Value.Number <- as.numeric(df$DEP.Result.Value.Number)
Code
library(dplyr)
library(tidyr)
library(ggplot2)

# 1. Ensure the result values are numeric
df$DEP.Result.Value.Number <- as.numeric(df$DEP.Result.Value.Number)

# 2. Build a wide “presence” table per Location × Analyte
presence_table <- df %>%
  group_by(Monitoring.Location.ID, DEP.Analyte.Name) %>%
  summarise(
    # 1 if any non-NA exists, else 0
    presence = ifelse(any(!is.na(DEP.Result.Value.Number)), 1L, 0L),
    .groups = "drop"
  ) %>%
  pivot_wider(
    names_from  = DEP.Analyte.Name,
    values_from = presence,
    values_fill = list(presence = 0L)
  )

# 3. Pivot back to long for ggplot
heat_long <- presence_table %>%
  pivot_longer(
    cols      = -Monitoring.Location.ID,
    names_to  = "DEP.Analyte.Name",
    values_to = "presence"
  )

# 4. Draw the heatmap with a white→steelblue gradient
ggplot(heat_long,
       aes(x = DEP.Analyte.Name,
           y = Monitoring.Location.ID,
           fill = presence)) +
  geom_tile(color = "grey90") +
  scale_fill_gradient(
    low    = "white",
    high   = "steelblue",
    limits = c(0, 1),
    breaks = c(0, 1),
    labels = c("0 (none)", "1 (some)")
  ) +
  labs(
    x    = "DEP Analyte Name",
    y    = "Monitoring Location ID",
    fill = "Presence\n(0/1)"
  ) +
  theme_minimal(base_size = 12) +
  theme(
    axis.text.x  = element_text(angle = 45, hjust = 1),
    panel.grid   = element_blank()
  )

create map
library(leaflet)
library(dplyr)

# Filter out rows with missing coordinate data
df_map <- df %>% filter(!is.na(DEP.Latitude) & !is.na(DEP.Longitude))

# Create a zoomable, interactive map with clustered circle markers for improved performance
leaflet(df_map) %>%
  addProviderTiles(providers$OpenStreetMap) %>%  # Use OpenStreetMap tiles
  addCircleMarkers(
    lng = ~DEP.Longitude, 
    lat = ~DEP.Latitude, 
    radius = 4,
    color = "blue",
    fillOpacity = 0.5,
    popup = ~paste("Organization:", Organization.ID, "<br>",
                   "Monitoring Location:", Monitoring.Location.ID),
    clusterOptions = markerClusterOptions()  # Enable clustering
  )